# To change this template, choose Tools | Templates
# and open the template in the editor.

from game.fov import *
from game.state.gamestate import *

class MovingState(GameState):
    def __init__(self, data):
        GameState.__init__(self, data)

    def update(self, ms):
        dat = self.data

        #sd.msg_mgr.add_msg("mouse is ({0}, {1})".format(m_x, m_y))
        c_char = dat.sched_mgr.peek()

        if c_char != dat.main_char:
            while c_char != dat.main_char:
                c_char.update_ai(dat)
                c_char = dat.sched_mgr.peek()
        else:
            d = c_char.move_step(dat)
            dat.level.apply_fog()
            do_fov(dat.level, c_char.pos(), 10)
            dat.gui.game_area.adjust_view()
            if d:
                dat.state_mgr.pop_state()

        return 1

    def draw(self, ms):
        self.normal_draw(ms)